package com.goldsprite.gameframeworks.ecs.component;

import com.goldsprite.gameframeworks.ecs.system.renderer.Gizmos;
import com.goldsprite.gameframeworks.simplephys.shape.*;

public class CircleColliderComponent extends ColliderComponent<PhysCircle> {
	private PhysCircle circle = new PhysCircle();

	public CircleColliderComponent() {
		setRadius(0.5f);
	}

	public float getRadius() {
		return circle.radius;
	}

	public void setRadius(float radius) {
		circle.setRadius(radius);
	}

	@Override
	public PhysCircle getShape() {
		circle.set(getWorldPosition(), getRadius());
		return circle;
	}

	@Override
	public ShapeType getShapeType() {
		return ShapeType.Circle;
	}

	@Override
	public void drawGizmos() {
		float cx = getWorldRenderPosition().x;
		float cy = getWorldRenderPosition().y;
		float radius = getRadius();
		Gizmos.setColor(PhysColor.Default.val);
		Gizmos.circle(cx, cy, radius);
	}
}
